<script>
    export default {
        props: {
            // 导航栏背景色
            navBackgroundColor: {
                default: "#FF4C4C"
            },
            // 标题颜色
            titleColor: {
                default: "#000000"
            },
            //标题文字
            title: {
                required: false,
                default: "来画大世界"
            },
            // 是否显示后退按钮
            backVisible: {
                required: false,
                default: false
            },
            // home按钮的路径
            homePath: {
                required: false,
                default: ""
            },
        //    地址位置
            posLabel:{
                required: true,
                default: "未知"
            }
        },
        data() {
            return {
                statusBarHeight: "", // 状态栏高度
                titleBarHeight: "", // 标题栏高度
                navBarHeight: "", // 导航栏总高度
                platform: "",
                model: "",
                brand: "",
                system: ""
            };
        },
        beforeMount() {
            const self = this;
            wx.getSystemInfo({
                success(system) {
                    console.log(`system:`, system);
                    //获取状态栏高度
                    self.statusBarHeight = system.statusBarHeight;
                    //获取客户的平台
                    self.platform = system.platform;
                    //获取设备型号
                    self.model = system.model;
                    //获取设备品牌
                    self.brand = system.brand;
                    //获取操作系统及版本
                    self.system = system.system;

                    let platformReg = /ios/i;
                    if (platformReg.test(system.platform)) {
                        self.titleBarHeight = 44;
                    } else {
                        self.titleBarHeight = 48;
                    }
                    self.navBarHeight = self.statusBarHeight + self.titleBarHeight;
                }
            });
        },
        mounted() {
        },
        methods: {
            /**
             * @Description 点击地址
             * @author 焦政
             * @date 2019/4/26
             */
            e_click(){
                console.log('选择地址')
                wx.navigateTo({
                    url: '/pages/currentAddress/main',
                })
            }
        }
    };
</script>
<template>
    <div class="comp-navbar">
        <!-- 占位栏 -->
        <cover-view class="placeholder-bar" :style="{height: navBarHeight + 'px'}"></cover-view>
        <!-- 导航栏主体 -->
        <cover-view class="navbar" :style="{height: navBarHeight + 'px',backgroundColor:navBackgroundColor}">
            <!-- 状态栏 -->
            <cover-view class="nav-statusbar" :style="{height: statusBarHeight + 'px'}"></cover-view>
            <!-- 标题栏 -->
            <cover-view class="nav-titlebar" :style="{height: titleBarHeight + 'px' }">
                <!-- 功能区 home及后退键 -->
                <cover-view class="bar-options" @click="e_click">
                    <!--位置logo-->
                    <cover-view class="posLogoArea">
                        <cover-image class="posLogo" src="/static/images/pos.png"></cover-image>
                    </cover-view>
                    <!-- 位置名称-->
                    <cover-view class="posLabel">
                       {{posLabel}}
                    </cover-view>
                </cover-view>
                <!-- 标题 -->
                <!--                <cover-view class="bar-title" :style="[{color:titleColor}]">{{title}}</cover-view>-->
            </cover-view>
        </cover-view>
    </div>
</template>
<style lang='scss'>
    @import "BaseNavigationBar";
</style>
